package com.hj.saapp.control.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;


import com.hj.saapp.BCDApplication;
import com.hj.saapp.R;
import com.hj.saapp.bean.MultipleListDialogBean;

import java.util.ArrayList;

/**
 * Created by Administrator on 2015/10/16.
 */
public class ListMultipleDialogAdapter extends BaseAdapter{

    ArrayList<MultipleListDialogBean> mData;

    public ListMultipleDialogAdapter(ArrayList<MultipleListDialogBean> mData)
    {
        this.mData = mData;
    }

    @Override
    public int getCount() {
        return  this.mData.size();
    }

    @Override
    public Object getItem(int position) {
        return  this.mData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {


        View view = LayoutInflater.from(BCDApplication.getApp()).inflate(R.layout.view_list_dialog_multiple_adapter_item,null);



        ImageView mSelectIg;
        TextView mText;

        mSelectIg = (ImageView) view.findViewById(R.id.selectIg);
        mText = (TextView) view.findViewById(R.id.text);

        mText.setText(mData.get(position).content);

        if (mData.get(position).isSelect)
        {
            mSelectIg.setVisibility(View.VISIBLE);
        }
        else
        {
            mSelectIg.setVisibility(View.GONE);
        }

        return view;
    }
}
